<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function timeoutPromise(delay) {
      return new Promise((resolve, reject) => {
        setTimeout(() => {
          //   console.log(1)
          resolve(`延迟了${delay}秒`)
        }, delay * 1000)
      })
    }

    const p = new timeoutPromise(1)
      .then((res) => {
        console.log(res) // 打印1
        return timeoutPromise(2)
      })
      .then((res) => {
        console.log(res) //打印2
        return timeoutPromise(3)
      })
      .then((res) => {
        console.log(res) //打印3
      })
  </script>
</body>

</html>